<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> 
<head>
<%@ include file="../../include/easyui.jsp" %>
<title>立项(合同)</title>
<script>
	var cFn = {};
	$(function(){
		var contracthref = '/console/contract/choosebox';
		var pojecthref = '/console/project/choosebox';
		
		cFn = {
			getTabTitle:function(){
				return $("#select_title").val();
			},
			getIframe: function(id){
				return $(id)[0];
			}
		};
		
		$('#tt').tabs({    
		    border:false,    
		    onSelect:function(title){    
		        $("#select_title").val(title);
		    }    
		});  
		
		var tabs = $('#tt').tabs('add',{    
		    title:'合同列表',    
		    content:'<iframe id="contractF" scrolling="yes" frameborder="0"  src="'  
	            + contracthref  + '" style="width:100%;height:98%;"></iframe>'
		})
		.tabs('add',{    
		    title:'项目列表',    
		    content:'<iframe id="projectF" scrolling="yes" frameborder="0"  src="'  
	            + pojecthref  + '" style="width:100%;height:98%;"></iframe>'
		}); 
		
	});
	
	
	function choose(){
		var result = [];
		var item = null;
		var t = cFn.getTabTitle();
		if(t=='项目列表'){
			var result_ = cFn.getIframe('#projectF').contentWindow.choose(); 
			if(result_.length>0){
				item = $.extend(result_[0], { billKind:'工程发票' } );
				item.pNo =item.pNo+'[单项]' ;
				result.push(item);
			}
		}else{
			var result_ = cFn.getIframe('#contractF').contentWindow.choose(); 
			if(result_.length>0){
				item = result_[0];
				item = $.extend(item , { billKind:'合同发票',pNo:item.contractNo+'['+ item.contractLevel +']' } );
				result.push(item);
			}
		}
		return result;
	}
</script>
</head>
<body class="easyui-layout">
	<input type="hidden" id="select_title" value="" />
	<div id="tt" class="easyui-tabs" data-options="fit:true,border:true"></div>
</body>
</html>